package main

import (
	"bootstrap"
	"flag"
	"leaf"
	"login_server/center"
	. "login_server/internal"
	"login_server/logic"
)

// init
import (
	_ "login_server/logic/launcher"
)

var (
	configPath string
)

func init() {
	flag.StringVar(&configPath, "config", "login_server.json", "game center internal file path")
}

func main() {
	flag.Parse()
	Config.Parse(configPath)

	defer bootstrap.Close()
	args := new(bootstrap.StartArgs)
	args.Config = &Config.Bootstrap
	if err := bootstrap.Start(args); err != nil {
		panic(err)
	}

	leaf.Run(
		&Config.Leaf,
		logic.Module,
		center.Module,
	)
}
